$(document).ready(function () {
    initUser();
})

/*function deleteArticle(id) {
    $.ajax({
        url:"/api/deletearticle/"+id,
        type:"Delete",
        dataType:"json",
        success:function(data){
            initArticle();
            layer.msg(data.message,{icon: 5});
        },
        error:function () {
            layer.msg("系统错误！",{icon: 5});
        }
    });
}*/

function initUser() {
    $.ajax({
        type: 'get',
        url: '/api/user',
        dataType:"json",
        data:{
          "pageSize":20,
          "pageNumber":0
        },
        success: function (result) {
            var data = result.data;
            $(".tbody_con").html("")
            // $("#article_account").html(result.totalCount)
            var val = "";
            data.forEach(function(value,index){

                val = val+ "<tr>" +
                    "<td style=\"line-height: 60px;\">" +
                "<img src=\""+value.icon+"\"/>" +
                "</td>" +
                "<td style=\"line-height: 60px;\">"+value.username+"</td>" +
                "<td style=\"line-height: 60px;\">"+value.nickname+"</td>" +
                "<td style=\"line-height: 60px;\">1</td>" +
                "<td style=\"line-height: 60px;\">1</td>" +
                "<td style=\"line-height: 60px;\">" +
                "<a role=\"button\" class=\"btn_edit\" href=\"/api/setrole/"+value.id+"\"  style=\"border: 1px solid #e7505a;padding: 2px 4px;margin: 0px 4px;\"> <span class='glyphicon glyphicon-file'></span> 编辑角色 </a>" +
                "<a role=\"button\" class=\"btn_edit\" style=\"border: 1px solid #F37B1D;padding: 2px 4px;margin: 0px 4px;\"> <span class='glyphicon glyphicon-remove-sign'></span> 屏蔽 </a>" +
                "</td>" +
                "</tr>";
            });
            $(".tbody_con").append(val)
        },
        error:function () {
            layer.msg("系统错误！",{icon: 5});
        }
    });
}

